import { _decorator, Component, Node, v3 } from 'cc';

const { ccclass, property } = _decorator;

@ccclass('TestQTween')
export class TestQTween extends Component {
    @property(Node)
    private moveToNode: Node = null;

    @property(Node)
    private scaleToNode: Node = null;

    protected start(): void {
        this.scheduleOnce(() => {
            this.moveTo();
            this.scaleTo();
        }, 3);
    }

    private moveTo(): void {
        this.moveToNode.qtPosition(v3(this.moveToNode.x + 500, this.moveToNode.y, this.moveToNode.z), 2, {
            easing: 'sineInOut',
            onComplete: () => {
                console.log('Move completed');
            }
        }).start();
    }

    private scaleTo(): void {
        this.scaleToNode.qtScale(v3(2, 2, 2), 2, {
            easing: 'sineInOut',
            onComplete: () => {
                console.log('Scale completed');
            }
        }).start();
    }
}